package net.shopxx.dao.impl;

import java.util.List;

import net.shopxx.dao.ProduceOrderDao;
import net.shopxx.entity.Navigation;
import net.shopxx.entity.ProduceOrder;
import net.shopxx.entity.Navigation.Position;

import org.springframework.stereotype.Repository;

/**
 * Dao实现类 - 生产人员
 */

@Repository
public class ProduceOrderDaoImpl extends BaseDaoImpl<ProduceOrder, String> implements ProduceOrderDao {

	// 关联处理
	@Override
	public void delete(ProduceOrder deliveryCorp) {
//		Set<DeliveryType> deliveryTypeSet = deliveryCorp.getDeliveryTypeSet();
//		if (deliveryTypeSet != null) {
//			for (DeliveryType deliveryType : deliveryTypeSet) {
//				deliveryType.setDefaultDeliveryCorp(null);
//			}
//		}
		super.delete(deliveryCorp);
	}

	// 关联处理
	@Override
	public void delete(String id) {
		ProduceOrder produceorder = load(id);
		this.delete(produceorder);
	}

	// 关联处理
	@Override
	public void delete(String[] ids) {
		for (String id : ids) {
			ProduceOrder produceorder = load(id);
			this.delete(produceorder);
		}
	}

	@SuppressWarnings("unchecked")
	public List getLoadByDistrib() {
		String hql = "SELECT Count(produce_id) as aa,distribStaff FROM ProduceOrder  GROUP BY distribStaff";
		return getSession().createQuery(hql).list();
	}
	
}